All Questions
Tagged with treeobject-oriented
23 questions
2votes
1answer
135views
QuadTree implementation in c++
I'm new on C++ and OOP. I wrote the following QuadTree implementation (I didn't wrote the remove object part yet). please take a look on it and provide feedback, mainly about C++ OOP design, ...
10votes
2answers
2kviews
Iterator for traversing a tree [v2]
this is an update of the implementation after I followed the feedback from Iterator for traversing a tree. After that I did changed quite a bit on the design and decided to ask for another round of ...
4votes
1answer
707views
An implementation of an AVL tree with unique_ptr
I've implemented an AVL tree using unique_ptr. The code has been stress-tested and there are no crashes or segmentation faults. I left the program running at night and stopped it manually the next ...
3votes
1answer
3kviews
Java n-ary Tree class with custom made methods and nested Node class
I'm a beginner and I wrote this (working) code for n-ary tree. The specifics: Each node is to be built with an integer value. Each node has a variable number of children. The nodes should have an ...
0votes
1answer
2kviews
Generic Binary Search Tree Implementation in Java
There is an implementation of Binary Search Tree. This is kind of based on Set Theory that duplicates are not allowed but an attempt to adding the same node twice will replace the older node. BSTNode ...
3votes
0answers
2kviews
AVL Tree with delete method in Python 3
Just a general code review. I'm looking for my first developer job so anything constructive is awesome. Please, and thank you very much. I've written this implementation as an exercise and to add to ...
1vote
1answer
75views
Traversing the Parent-child relationship between objects: Part 2
This code builds on the code in the previous iteration. All of the following tests should work: ...
5votes
1answer
2kviews
Traversing the parent-child relationship between objects
I wrote this code because I was often annoyed that I couldn't get the parent object. This class allows you to traverse the parent-child relationship between objects, in both directions. It also ...
0votes
1answer
353views
Ruby BST code for insertion implementation
After some help in understanding difference why direct assignment with setter methods don't work, here is my code for a simple BST in ruby. Would appreciate your reviews and suggestions to refactor ...
2votes
1answer
346views
Object oriented design for a Tree
I am implementing a Tree in Java. It must be easy to add a new type of tree e.g. Binary tree and Tertiary tree. Each node can have at least one value. It must be easy to make a new type of node and ...
1vote
1answer
122views
Walk on tree with different actions on different nodes
I have a tree whose nodes are of type Node. Depending on the type (one of the implementations of Node) nodes differ in the set ...
6votes
2answers
4kviews
Python Binary Search Tree
As an exercise to get better in Python, I decided to implement a Binary Search Tree. This implementation uses two classes: BSTNode and BSTree. Because most methods were implemented using recursion, I ...
1vote
1answer
749views
Count number of leaves in binary tree
Description: Given a binary tree find the number of leaves. Although the problem is simple and has been solved many times I am more interested in find object oriented ways to solve the algorithmic ...
3votes
2answers
1kviews
C++ binary search tree, not using recursion
I made binary search tree using classes. I would like to know if I could do something better or maybe there is something wrong with my code. I decided not to use recursion. I would be very thankful ...
1vote
1answer
2kviews
RB Tree Left and Right Rotate Functions
I am writing a program to implement the Red-Black Tree data structure in java. Below is the beginning of my implementation, namely the left and right rotate functions. I want to know if these ...